/**
 * 
 * @author Paul Peasegood
 *
 */
public class Weapon 
{


		private int toHit;
        private Dice damage;
        private int apCost;
        private int energyCost;
        private int weight;
        
        public Weapon()
        {
        	this.toHit = 10;
        	this.damage = new Dice(2,6,1);
        	this.apCost = 25;
        	this.energyCost = 25;
        	this.weight = 0;
        }
        /**
         * Constructor for weapon with custom damage, but default properties
         * @param toHit - toHit bonus
         * @param diceNum - number of dice to be rolled for damage
         * @param diceSides - number of sides on dice rolled for damage
         * @param damBonus - damage bonus added to total damage
         */
        public Weapon(int toHit, int diceNum, int diceSides, int damBonus)
        {
                this.toHit = toHit;
                this.damage = new Dice(diceNum, diceSides, damBonus);
                this.apCost = 25;
                this.energyCost = 25;
                this.weight = 0;
        }
        /**
         * Constructor for a fully custom weapon
         * @param toHit - toHit bonus
         * @param diceNum - number of dice to be rolled for damage
         * @param diceSides - number of sides on dice rolled for damage
         * @param damBonus - damage bonus added to total damage
         * @param useCost - the cost of AP and energy to use the weapon 
         * @param weight - weight of the weapon
         */
        public Weapon(int toHit, int diceNum, int diceSides, int damBonus, int useCost, int energyCost, int weight)
        {
                this.toHit = toHit;
                this.damage = new Dice(diceNum, diceSides, damBonus);
                this.apCost = useCost;
                this.energyCost = energyCost;
                this.weight = weight;
        }

        
        public int getWeight()
        {
        	return this.weight;
        }
        
        public int getApCost()
        {
        	return this.apCost;
        }
        
        public int getEnergyCost()
        {
        	return this.energyCost;
        }
        
        public Attack attack()
        {
        	int toHit;
        	int damage;
        	toHit = GameEngine.roll(100) + this.toHit;
        	damage = this.damage.roll();
        	System.out.println("toHit:" + toHit + " damage:" + damage);
        	return new Attack(toHit, damage);
        }
        /**
         * outputs weapon information in a user friendly form
         */
        public String toString()
        {
        	return "(+" + this.toHit + ") " +
        			this.damage + " cost:" + this.apCost; 
        }
}

